/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import controle.MbLogin;
import java.io.Serializable;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
import javax.faces.context.FacesContext;

/**
 *
 * @author diego.pagani
 */
public class LoginFilter implements Serializable, Filter {

    @Override
    public boolean isLoggable(LogRecord record) {
        System.out.println("############## estou sendo executado :O");
        MbLogin log = (MbLogin) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("loginBean");
        if (log.getLogin() == null) {
//            log.logout();
            return false;
        }
        System.out.println("############## estou sendo executado :O " + log.getLogin());

        return true;
    }
}
